<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Category;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Input;

class CategoryController extends Controller
{
    //展示
    public function index(){
        $category = new Category();
        $categoryInfo = $category->categoryInfo();

        return view('admin.Category_index')->with('categoryInfo',$categoryInfo);
    }

    //添加
    public function add(){
        $categoryList = [1 => '男鞋','女鞋','男装','女装','儿童','配件','店铺用品','陈列道具'];

        return view('admin.Category_add')->with('categoryList',$categoryList);
    }

    //修改
    public function edit(Request $request){
        $id = Input::get('id');
        print_r($id);
        exit;
        $category = new Category();

    }

    //保存
    public function save(Request $request){
        //获取数据
       $data = $request->all();

       //实例化对象
       $category = new Category();
       $result = $category->saveCategory($data);
       //返回数据
       dd($result);

    }
}
